﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Microsoft.FSharp.Core;

namespace CoreReset {

    using ContextGraphDict = Dictionary<ContextGraph.Context, Dictionary<ContextGraph.Context, FSharpRef<setOfPairs.DFR>>>;

    /// <summary>
    /// A command tree node is a TreeNode which holds
    /// properties associated with a core language command:
    /// Context Graph(as data structure and as textual string) and Id.
    /// </summary>
    public class CmdTreeNode : TreeNode {

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="id">The command identifier.</param>
        /// <param name="text">The command text (the text appearing in the AST).</param>
        public CmdTreeNode(int id, string text)
            : base(text) {
            GraphText = null;
            Graph = null;
            m_id = id;
        }

        /// <summary>
        /// Gets the command identifier.
        /// </summary>
        public int Id {
            get {
                return m_id;
            }
        }

        /// <summary>
        /// Gets or sets the context graph associated with the command.
        /// </summary>
        public ContextGraphDict Graph { get; set; }

        /// <summary>
        /// Gets or sets the context graph (in textual format) associated with the command.
        /// </summary>
        public string GraphText { get; set; }

        /// <summary>
        /// The command identifier.
        /// </summary>
        private readonly int m_id = -1;
    }
}